package com.csw;

import java.sql.*;

public class Demo08PhoenixJDBC {
    public static void main(String[] args) throws SQLException {
        Connection conn = DriverManager.getConnection("jdbc:phoenix:master,node1,node2:2181");

        String sql="select end_date,MDN,COUNTY from DIANXIN where end_date = ? and COUNY = ?";
        PreparedStatement preparedStatement = conn.prepareStatement(sql);
        preparedStatement.setString(1,"20180503154014");
        preparedStatement.setString(2,"8340104");

        ResultSet rs = preparedStatement.executeQuery();
        while (rs.next()){
            String end_date = rs.getString("end_date");
            String MDN = rs.getString("MDN");
            String COUNTY = rs.getString("COUNY");
            System.out.println(end_date + "\t" + MDN + "\t" + COUNTY);
        }
        conn.close();
    }
}
